package com.iworkh.spring.beans.factory;

import com.iworkh.spring.beans.bean.entity.Car;
import org.springframework.beans.factory.FactoryBean;

/**
 * FactoryBean用法
 *
 * @author: iworkh-沐雨云楼
 * @date: 2019-12-18
 */
public class CarFactoryBean implements FactoryBean<Car> {

    private String owner;

    private String brand;

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    @Override
    public Car getObject() throws Exception {
        return new Car(this.owner,this.brand);
    }

    @Override
    public Class<?> getObjectType() {
        return Car.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
